#ifndef CPRIMPLAN_H
#define CPRIMPLAN

#include "IPrimitive.h"
#include "toolTypes.h"

class CPrimPlan : public IPrimitive
{
private:
	float m_A, m_B, m_C, m_D; //represent the coefficient in the equation Ax + By + Cz + D = 0
	CPoint3f m_point; //a point of the plan
	CNormal3f m_normal;

	CVector3f m_p1, m_p2, m_p3; //3 points in the plan

public:
	CPrimPlan(const CPoint3f& p1, const CPoint3f& p2, const CPoint3f& p3);
	~CPrimPlan();

	bool intersect(const CRay& ray, float& dist, bool useGlobalCoordinates);
	void computeNormal(const CRay& ray, float dist, CVector3f& normal)const;
	bool isInside(const CVector3f& p)const;

};

#endif